package com.example.rk.mapper;

import com.example.rk.entity.Changest;
import com.example.rk.entity.Company;
import com.example.rk.entity.Job;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface CompanyMapper {

    @Delete("delete from company where id=#{id}")
    void deleteById(int id);
    @Select("select * from company where name=#{name} and position=#{position}")
    Company findadd(@Param("name") String name,@Param("position")  String position);
    @Insert("insert into company (name,location,position,data,cid) values(#{name},#{location},#{position},#{data},#{cid})")
    void create(Company company);
    @Select("SELECT * FROM company where id=#{id}")
    Company findByID(int id);
    @Update("update company set location=#{location},position=#{position},name=#{name},data=#{data}  where id=#{id}")
    void doEdit(Company company);
    List<Company> findBySearch(String name, String position);

    int count(String code, String name);

    List<Job> findBySearchWithPage( String name,String location,String position,String data);
    @Select("SELECT * FROM company where cid=#{id}")
    List<Company> findonly(int id);

    List<Company> findBySearch1( int cid,String name, String position);
    @Update("update changest set location=#{tupian} where id=#{id}")
    void setImageUrl(@Param("tupian")  String tupian,@Param("id")  int id);
    @Insert("insert into changest (cid,name,dizhi,faren,phone,tupian) values(#{cid},#{name},#{dizhi},#{faren},#{phone},#{tupian})")
    void creattupian(Changest changest);
}
